/*
 *
 * Copyright (C) 2012 Walter Lütgenau
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package offset.nodes.client.xpath.model;

import java.util.HashMap;

/**
 *
 * @author Walter Lütgenau
 */
public class XPathOperators {
    static HashMap<Operator,XPathOperator> xpathOperators = new HashMap<Operator,XPathOperator>();
    static {
        xpathOperators.put(Operator.equal, new XPathOperator(Operator.equal, "=", XPathOperatorType.operator));
        xpathOperators.put(Operator.notEqual, new XPathOperator(Operator.notEqual, "!=", XPathOperatorType.operator));
        xpathOperators.put(Operator.greater, new XPathOperator(Operator.greater, ">", XPathOperatorType.operator));
        xpathOperators.put(Operator.greaterEqual, new XPathOperator(Operator.greaterEqual, ">=", XPathOperatorType.operator));
        xpathOperators.put(Operator.less, new XPathOperator(Operator.less, "<", XPathOperatorType.operator));
        xpathOperators.put(Operator.lessEqual, new XPathOperator(Operator.lessEqual, "<=", XPathOperatorType.operator));
        xpathOperators.put(Operator.like, new XPathOperator(Operator.like, "jcr:like", XPathOperatorType.function));
        xpathOperators.put(Operator.contains, new XPathOperator(Operator.contains, "jcr:contains", XPathOperatorType.function));
        xpathOperators.put(Operator.deref, new XPathOperator(Operator.deref, "jcr:deref", XPathOperatorType.function));
    }
    
    /**
     * Return the xpath specific operator characteristics for the given operator.
     * 
     * @param operator
     * @return the xpath specific operator characteristics.
     */
    public static XPathOperator get(Operator operator) {
        return xpathOperators.get(operator);
    }
}
